package test1;

import java.util.Arrays;
import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] b = new int[a];
        for (int i = 0; i < a; i++){
            b[i] = sc.nextInt();
        }

        System.out.println(test(b));
    }

    public static String test(int[] nums){

        String a = "YES";
        Arrays.sort(nums);
        for (int i = 0; i < nums.length; i++){
            if (i == 0) continue;
            if (nums[i] == nums[i - 1]) continue;
            if (nums[i] % nums[i - 1] != 0 || (nums[i] / nums[i - 1]) % 2 != 0) {
                a = "NO";
                return a;
            }
        }
        return a;
    }
}
